<template>
  <div class="home" v-loading="loading">
    <div class="operation-wrap">
      <el-row>
        <el-col :span="6">
          <div class="grid-content" @click="addClick($event,'/welfare/welfare')">
            <div class="pic">
              <Icon :iconname="'#icon-dianpu'"></Icon>
            </div>
            <div class="info">
              <h3>{{top_data.supplier_total}}</h3>
              <p>店铺总量</p>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="grid-content" @click="addClick($event,'/user/user/index')">
            <div class="pic">
              <Icon :iconname="'#icon-hiuyuan'"></Icon>
            </div>
            <div class="info">
              <h3>{{top_data.user_total}}</h3>
              <p>车主总量</p>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="grid-content" @click="addClick($event,'/car/index')">
            <div class="pic">
              <i class="el-icon-edit icons"></i>
            </div>
            <div class="info">
              <h3>{{top_data.car_total}}</h3>
              <p>车辆总量</p>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="grid-content"  @click="addClick($event,'/order/car_order/index')">
            <div class="pic">
              <Icon :iconname="'#icon-dingdanshu'"></Icon>
            </div>
            <div class="info">
              <h3>{{top_data.order_total}}</h3>
              <p>订单总量</p>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>

    <!--待办事项-->
    <div class="matters-wrap">
      <div class="common-form mt16">
        待办事项<span class="ml10 f14 gray" style="font-weight: normal;">请尽快处理，以免影响营业</span>
      </div>
      <el-row class="border-b">

        <el-col :span="2">
          <div class="matters">

          </div>
        </el-col>
        <el-col :span="4">
          <div class="matters" @click="addClick($event,'/user/user/member')">
            <div class="box ">
              <div class="title">用户认证</div>
              <ul>
                <li >待审核：<span class="fb">{{wait_data.attestation_info.apply}}</span></li>

              </ul>
            </div>
          </div>
        </el-col>

        <el-col :span="4">
          <div class="matters" @click="addClick($event,'/user/user/index')">
            <div class="box ">
              <div class="title">车主认证</div>
              <ul>
                <li @click="addClick($event,'/user/user/index')">待审核：<span class="fb">{{wait_data.register_info.apply}}</span></li>

              </ul>
            </div>
          </div>
        </el-col>

        <el-col :span="4">
          <div class="matters" @click="addClick($event,'/car/index')">
            <div class="box ">
              <div class="title">车辆-待审核</div>
              <ul>
                <li @click="addClick($event,'/car/index')">待审核车辆：<span class="fb">{{wait_data.cars.apply}}</span></li>

              </ul>
            </div>
          </div>
        </el-col>

      </el-row>
    </div>

    <div class="home-index">
      <!--main-index-->
      <div class="main-index">
        <div class="common-form mt16">
          今日概况
        </div>
        <el-row class="border-b">
          <el-col :span="6">
            <div class="grid-content" @click="addClick($event,'/lhdata/dayindex')">
              <div class="pic">
                <Icon :iconname="'#icon-xiaoshou'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.order_total_price.tday}}</h3>
                <p class="des">销售额(元)</p>
                <p class="yesterday">昨日：{{today_data.order_total_price.ytd}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/dayorder')">
              <div class="pic">
                <Icon :iconname="'#icon-icon1'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.order_total.tday}}</h3>
                <p class="des">支付订单数</p>
                <p class="yesterday">昨日：{{today_data.order_total.ytd}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/dayorder')">
              <div class="pic">
                <Icon :iconname="'#icon-icon1'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.order_total_done.tday}}</h3>
                <p class="des">已完成订单数</p>
                <p class="yesterday">昨日：{{today_data.order_total_done.ytd}}</p>
              </div>
            </div>
          </el-col>
          <!-- <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/dayorder')">
              <div class="pic">
                <Icon :iconname="'#icon-icon1'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.new_supplier_total.tday}}</h3>
                <p class="des">押金退回动向</p>
                <p class="yesterday">昨日：{{today_data.new_supplier_total.ytd}}</p>
              </div>
            </div>
          </el-col> -->
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/user/user/index')">
              <div class="pic">
                <Icon :iconname="'#icon-xinzengyonghu'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.new_owner_total.tday}}</h3>
                <p class="des">新增车主数</p>
                <p class="yesterday">昨日：{{today_data.new_owner_total.ytd}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/user/user/member')">
              <div class="pic">
                <Icon :iconname="'#icon-xinzengyonghu'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.new_user_total.tday}}</h3>
                <p class="des">新增用户数</p>
                <p class="yesterday">昨日：{{today_data.new_user_total.ytd}}</p>
              </div>
            </div>
          </el-col>
        </el-row>

      </div>

      <!--side-->
      <div class="side"></div>
    </div>

    <div class="home-index">
      <!--main-index-->
      <div class="main-index">

        <el-row class="border-b">
          <el-col :span="6">
            <div class="grid-content" @click="addClick($event,'/lhdata/daysj')">
              <div class="pic">
                <Icon :iconname="'#icon-piliangxiadan'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.owner_order.tday}}</h3>
                <p class="des">司机接单量</p>
                <p class="yesterday">昨日：{{today_data.owner_order.ytd}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/daysjtd')">
              <div class="pic">
                <Icon :iconname="'#icon-piliangxiadan'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.owner_order_return.tday}}</h3>
                <p class="des">司机退单量</p>
                <p class="yesterday">昨日：{{today_data.owner_order_return.ytd}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/daysjtd')">
              <div class="pic">
                <Icon :iconname="'#icon-xinzengyonghu'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.user_login_total.tday}}</h3>
                <p class="des">每日用户登录量</p>
                <p class="yesterday">昨日：{{today_data.user_login_total.ytd}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/dayw')">
              <div class="pic">
                <Icon :iconname="'#icon-piliangxiadan'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.welfare_total.tday}}</h3>
                <p class="des">福利交易</p>
                <p class="yesterday">昨日：{{today_data.welfare_total.ytd}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/daysjtd')">
              <div class="pic">
                <Icon :iconname="'#icon-piliangxiadan'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.car_total.tday}}</h3>
                <p class="des">新增车辆</p>
                <p class="yesterday">昨日：{{today_data.car_total.ytd}}</p>
              </div>
            </div>
          </el-col>
        </el-row>

      </div>

      <!--side-->
      <div class="side"></div>
    </div>


    <div class="home-index">
      <!--main-index-->
      <div class="main-index">
        <div class="common-form mt16">
          每月概况
        </div>
        <el-row class="border-b">
          <el-col :span="6">
            <div class="grid-content" @click="addClick($event,'/lhmonth/monthindex')">
              <div class="pic">
                <Icon :iconname="'#icon-xiaoshou'"></Icon>
              </div>
              <div class="info">
                <h3>{{month_data.order_total_price.tmonth}}</h3>
                <p class="des">销售额(元)</p>
                <p class="yesterday">上月：{{month_data.order_total_price.ymonth}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhmonth/monthorder')">
              <div class="pic">
                <Icon :iconname="'#icon-icon1'"></Icon>
              </div>
              <div class="info">
                <h3>{{month_data.order_total.tmonth}}</h3>
                <p class="des">支付订单数</p>
                <p class="yesterday">上月：{{month_data.order_total.ymonth}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/daysjtd')">
              <div class="pic">
                <Icon :iconname="'#icon-icon1'"></Icon>
              </div>
              <div class="info">
                <h3>{{month_data.order_total_done.tmonth}}</h3>
                <p class="des">已完成订单数</p>
                <p class="yesterday">上月：{{month_data.order_total_done.ymonth}}</p>
              </div>
            </div>
          </el-col>
          <!-- <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/lhdata/daysjtd')">
              <div class="pic">
                <Icon :iconname="'#icon-icon1'"></Icon>
              </div>
              <div class="info">
                <h3>{{today_data.new_supplier_total.tday}}</h3>
                <p class="des">押金退回动向</p>
                <p class="yesterday">上月：{{today_data.new_supplier_total.ytd}}</p>
              </div>
            </div>
          </el-col> -->
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/user/user/index')">
              <div class="pic">
                <Icon :iconname="'#icon-xinzengyonghu'"></Icon>
              </div>
              <div class="info">
                <h3>{{month_data.new_owner_total.tmonth}}</h3>
                <p class="des">新增车主数</p>
                <p class="yesterday">上月：{{month_data.new_owner_total.ymonth}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/user/user/member')">
              <div class="pic">
                <Icon :iconname="'#icon-xinzengyonghu'"></Icon>
              </div>
              <div class="info">
                <h3>{{month_data.new_user_total.tmonth}}</h3>
                <p class="des">新增用户数</p>
                <p class="yesterday">上月：{{month_data.new_user_total.ymonth}}</p>
              </div>
            </div>
          </el-col>
        </el-row>

      </div>

      <!--side-->
      <div class="side"></div>
    </div>

    <div class="home-index">
      <!--main-index-->
      <div class="main-index">

        <el-row class="border-b">
          <el-col :span="6">
            <div class="grid-content">
              <div class="pic">
                <Icon :iconname="'#icon-piliangxiadan'"></Icon>
              </div>
              <div class="info" @click="addClick($event,'/lhmonth/monthjd')">
                <h3>{{month_data.owner_order.tmonth}}</h3>
                <p class="des">司机接单量</p>
                <p class="yesterday">上月：{{month_data.owner_order.ymonth}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content">
              <div class="pic">
                <Icon :iconname="'#icon-piliangxiadan'"></Icon>
              </div>
              <div class="info" @click="addClick($event,'/lhmonth/monthtd')">
                <h3>{{month_data.owner_order_return.tmonth}}</h3>
                <p class="des">司机退单量</p>
                <p class="yesterday">上月：{{month_data.owner_order_return.ymonth}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/user/user/index')">
              <div class="pic">
                <Icon :iconname="'#icon-xinzengyonghu'"></Icon>
              </div>
              <div class="info">
                <h3>{{month_data.user_login_total.tmonth}}</h3>
                <p class="des">每月用户登录量</p>
                <p class="yesterday">上月：{{month_data.user_login_total.ymonth}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content">
              <div class="pic">
                <Icon :iconname="'#icon-piliangxiadan'"></Icon>
              </div>
              <div class="info" @click="addClick($event,'/lhmonth/monthw')">
                <h3>{{month_data.welfare_total.tmonth}}</h3>
                <p class="des">福利交易</p>
                <p class="yesterday">上月：{{month_data.welfare_total.ymonth}}</p>
              </div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content" @click="addClick($event,'/car/index')">
              <div class="pic">
                <Icon :iconname="'#icon-piliangxiadan'"></Icon>
              </div>
              <div class="info">
                <h3>{{month_data.car_total.tmonth}}</h3>
                <p class="des">新增车辆</p>
                <p class="yesterday">上月：{{month_data.car_total.ymonth}}</p>
              </div>
            </div>
          </el-col>
        </el-row>

      </div>

      <!--side-->
      <div class="side"></div>
    </div>
  </div>
</template>

<script>
  import IndexApi from '@/api/index.js';
  export default {
    data() {
      return {
        /*是否加载完成*/
        loading: true,
        /*统计信息*/
        top_data: [],
        /*待办事项*/
        wait_data: {
          order: {},
          agent: {},
          supplier: {},
          activity: {},
          audit: {},
          cars:{},
          register_info:{},
          attestation_info:{}
        },
        /*今日数据*/
        today_data: {
          order_total_price: {},
          order_total: {},
          new_user_total: {},
          new_owner_total:{},
          new_supplier_total: {},
          apply_supplier_total: {},
          car_total:{},
          welfare_total:{},
          owner_order:{},
          owner_order_return:{},
          order_total_done:{},
          user_login_total:{}
        },
        /*月数据*/
        month_data: {
          order_total_price: {},
          order_total: {},
          new_user_total: {},
          new_owner_total:{},
          car_total:{},
          welfare_total:{},
          owner_order:{},
          owner_order_return:{},
          order_total_done:{},
          user_login_total:{}
        }
      };
    },
    created() {
      /*获取数据*/
      this.getData();
    },
    methods: {
      /*获取数据*/
      getData() {
        let self = this;
        IndexApi.getCount(true).then(data => {
          self.loading = false;
          self.top_data = data.data.data.top_data;
          self.wait_data = data.data.data.wait_data;
          self.today_data = data.data.data.today_data;
          self.month_data = data.data.data.month_data;
        }).catch(error => {

        });
      },
      addClick(e,turl) {
        this.$router.push(turl);
      },
    }
  };
</script>

<style lang="scss" scoped>
  .icons{
        width: 30px;
        height: 30px;
        font-size: 30px;
  }
  .operation-wrap {
    width: 100%;
    height: 164px;
    border-radius: 8px;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 0 30px;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    background-size: 100% 100%;
    color: #3a8ee6;
  }

  .operation-wrap .grid-content {
    height: 164px;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .operation-wrap .grid-content h3 {
    font-size: 36px;
    line-height: 40px;
  }

  .operation-wrap .grid-content .info {
    margin-left: 10px;
  }

  .operation-wrap .grid-content .svg-icon {
    color: #3a8ee6;
  }

  .home-index {
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    min-width: 1000px;
    overflow-x: auto;
  }

  .main-index {
    flex: 1;
  }

  .main-index .grid-content,
  .operation-wrap .grid-content {

    display: -ms-flexbox;
    display: flex;
    -webkit-box-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }

  .main-index .grid-content {
    height: 120px;
  }

  .main-index .grid-content .pic {
    margin-right: 10px;
  }

  .main-index .grid-content h3 {
    font-size: 20px;
    font-weight: normal;
  }

  .main-index .grid-content .yesterday {
    color: #ccc;
  }

  .main-index .grid-content .svg-icon {
    color: #3a8ee6;
  }
  .matters-wrap{
    padding-bottom: 15px;
  }
  .matters-wrap .matters {
    display: -ms-flexbox;
    display: flex;
    -webkit-box-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    // height: 120px;
    margin-bottom: 15px;
  }

  .matters-wrap .matters .title {
    font-size: 14px;
    color: #fff;
    display: inline-block;
    height: 20px;
    line-height: 0;
    padding: 11px;
    // width: 40px;
    text-align: center;
    border-radius: 99px;
    margin-bottom: 20px;
    background: #3a8ee6;
  }

  .matters-wrap .matters ul {
    color: #999999;
  }

  .matters-wrap .matters ul span {
    padding-right: 6px;
    color: #3a8ee6;
  }
</style>
